﻿
<div ms-controller="tmpview">
    <table class="sui-table table-primary table-zebra">
        <thead>
            <tr>
                <th>标题</th>
                <th>分类</th>
                <th>图片</th>
                <th>时长</th>
                <th>转码状态</th>
                <th>浏览</th>
                <th style="width:80px">上传时间</th>
                <th style="width:60px">状态</th>
                <th style="width:180px">操作</th>
            </tr>
        </thead>
        <tbody>
            <tr ms-repeat-el="ListData">
                <td>{{el.Title}}</td>
                <td>{{el.TypeName}}</td>
                <td><img ms-src="ComFunJS.FilePath(el.ImgUrl,'/50/50')" /></td>
                <td>{{el.longTime}}</td>
                <td>{{Zmzt(el.zmzt)}}</td>
                <td>{{el.ViewQty}}</td>
                <td>{{el.CRTime|date('yyyy-MM-dd')}}</td>
                <td>
                    <span class='sui-text-success' ms-visible="el.IsShelf==1">上架</span>
                    <span class='sui-text-danger' ms-visible="el.IsShelf!=1">下架</span>
                </td>
                <td>
                    <a href="javascript:void(0);" class="sui-btn btn-bordered btn-warning" ms-click="SetShelf(el)" ms-if="top.model.HasAuth('UPDOWN')">{{el.IsShelf==1?'下架':'上架'}}</a>
                    <a href="javascript:void(0);" class="sui-btn btn-bordered btn-success" ms-click="ADD(el)" ms-if="top.model.HasAuth('EDIT')">编辑</a>
                    <a href="javascript:void(0);" class="sui-btn btn-bordered btn-danger" ms-click="DEL(el)" ms-if="top.model.HasAuth('DEL')">删除</a>
                </td>
            </tr>
        </tbody>
    </table>
    </div>

    <script type="text/javascript">

        var tempModel = avalon.define({
            $id: "tmpview",
            SetShelf: function (el) {
                $.getJSON("/adapi/video/shelf/" + el.ID, function (r) {
                    if (r.error == "") {
                        el.IsShelf = el.IsShelf == 1 ? 0 : 1;
                    }
                })

            },
            Zmzt: function (s) {
                var t = "未转码";
                if (s == "0") {
                    t = "正在转码";
                } else if (s == "1") {
                    t = "已转码";
                }
                return t;
            }
        });
    </script>


